package com.web.app.ctrl;


import com.web.app.dao.TaskWithStudentMapper;
import com.web.app.pojo.Task;
import com.web.app.pojo.TaskWithStudent;
import com.web.app.util.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 组员任务表 前端控制器
 * </p>
 *
 * @author 林
 * @since 2022-09-21
 */
@RestController
@CrossOrigin
public class TaskWithStudentController {

    @Autowired
    private TaskWithStudentMapper studentMapper;

    @RequestMapping("/getTaskWithStudent")
    public ResultUtil getTaskWithStudent(TaskWithStudent student){
        ResultUtil resultUtil = ResultUtil.ok();
        List<TaskWithStudent> students = studentMapper.getTaskWithStudent(student.getRelationTaskId());
        resultUtil.setData(students);
        return resultUtil;
    }

    @RequestMapping("/updateScore")
    public ResultUtil updateScore(TaskWithStudent student){
        ResultUtil resultUtil = ResultUtil.ok();
        studentMapper.updateById(student);
        return resultUtil;
    }


}

